<?php
/**
 * Created by PhpStorm.
 * User: 魏爷
 * Date: 2016/4/21
 * Time: 15:18
 */

namespace Home\Controller;


class MyInfoController extends BaseController
{
    /**
     * 个人信息
    **/
    public function personalInfo(){
        $u_id=getUserId();
        $user_list=D('Trade')->getUserInfo($u_id);
        $this->assign('_userList',$user_list);
        $this->display('MyInfo/personalInfo');
    }
    /**
     * 借阅信息
    **/
    public function readingInfo(){
        $u_id=getUserId();
        $getBorrowInfoById=D('Borrow')->getBorrowInfoById($u_id);
        $bookShowInfo=D('BookManage')->getAllBookInfo();
        $getAllUserInfo=D('UserLogin')->getAllUserInfo();
        $getUserType=D('UserType')->getUserType();
        $this->assign('_getBorrowInfoById',$getBorrowInfoById);
        $this->assign('_bookShowInfo',$bookShowInfo);
        $this->assign('_getAllUserInfo',$getAllUserInfo);
        $this->assign('_getUserType',$getUserType);
        $this->display('MyInfo/readingInfo');
    }

    /**
     * 解除银行卡绑定
    **/
    public function removeBank(){
        $u_id=getUserId();
        $res=D('UserLogin')->removeBank($u_id);
        if($res==false){
            $this->error('解除失败',null,true);
        }else{
            D('UserLogin')->setBankPwdNull($u_id);
            $this->success('解除成功',null,true);
        }
    }
    /**
     * 借阅状态修改
    **/
    public function setBorrowIfback(){
        $borrow_id=I('borrow_id');
        $res=D('Borrow')->setBorrowIfback($borrow_id);
        if($res==false){
            $this->error('提交失败',null,true);
        }else{
            $this->success('提交成功',null,true);
        }
    }
}